package com.yxw.job.task.livevod.fallback;

import com.yxw.live_vod_backend_facade.dto.ProductFeignQueryDTO;
import com.yxw.live_vod_backend_facade.feign.ProductFeignClient;
import com.yxw.live_vod_backend_facade.vo.ProductSpecificationVO;
import com.yxw.live_vod_backend_facade.vo.ProductVO;
import com.yxw.yxnet_cd_center.common.dto.PageVO;
import com.yxw.yxnet_cd_center.common.utils.BaseResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

@Slf4j
@Component
public class ProductFallbackFactory implements FallbackFactory<ProductFeignClient> {


    @Override
    public ProductFeignClient create(Throwable cause) {
        return new ProductFeignClient() {

            @Override
            public BaseResult<ProductVO> getProductById(Long productId) {
                return null;
            }

            @Override
            public BaseResult<PageVO<ProductVO>> getProductList(ProductFeignQueryDTO queryDTO) {
                return null;
            }

            @Override
            public BaseResult getProductStock(Long productId) {
                return null;
            }

            @Override
            public BaseResult addVodProductClickJob() {
                log.error(cause.getMessage());
                return new BaseResult<>("9999", "定时任务将点播商品详情存入数据库失败：" + cause.getMessage());
            }

            @Override
            public BaseResult<List<ProductSpecificationVO>> getProductSpecificationById(Long productId) {
                return null;
            }

            @Override
            public BaseResult<List<ProductVO>> getProductByNum(String productSeriesNum) {
                return null;
            }
            @Override
            public BaseResult isPutAwayById(String productId,Integer productStatus){
                return null;
            }
        };
    }
}
